import { PSControlObjectImpl } from '../pscontrol-object-impl';
import { IPSDEChartCoordinateSystem } from './ipsdechart-coordinate-system';
import { IPSSysPFPlugin } from '../../res/ipssys-pfplugin';

export class PSDEChartCoordinateSystemImplBase extends PSControlObjectImpl implements IPSDEChartCoordinateSystem {
  get eChartsType(): string {
    return this.M.eChartsType;
  }

  get index(): number {
    return this.M.index;
  }

  protected pssyspfplugin: IPSSysPFPlugin | null = null;

  getPSSysPFPlugin(): IPSSysPFPlugin | null {
    if (this.pssyspfplugin != null) return this.pssyspfplugin;
    const value = this.M.getPSSysPFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyspfplugin = this.getPSModel4('res.IPSSysPFPlugin', value, 'getPSSysPFPlugin') as IPSSysPFPlugin;
    return this.pssyspfplugin;
  }

  get psSysPFPlugin(): IPSSysPFPlugin | null {
    return this.getPSSysPFPlugin();
  }

  getPSSysPFPluginMust(): IPSSysPFPlugin {
    const value = this.getPSSysPFPlugin();
    if (value == null) {
      throw new Error('未指定前端扩展插件');
    }
    return value;
  }

  get type(): 'XY' | 'POLAR' | 'RADAR' | 'PARALLEL' | 'SINGLE' | 'CALENDAR' | 'MAP' | 'NONE' {
    return this.M.type;
  }

  get cls(): string {
    return 'PSDEChartCoordinateSystemImplBase';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.chart.IPSChartCoordinateSystem' || cls == 'control.chart.IPSDEChartCoordinateSystem') return true;
    return super.instanceof(cls);
  }
}
